package cn.exrick.xboot.base.vo

import cn.exrick.xboot.core.common.constant.CommonConstant
import cn.exrick.xboot.core.common.utils.NameUtil
import cn.exrick.xboot.core.entity.Role
import com.baomidou.mybatisplus.annotation.TableField
import com.fasterxml.jackson.annotation.JsonFormat
import io.swagger.annotations.ApiModelProperty
import lombok.Data
import lombok.experimental.Accessors
import org.springframework.format.annotation.DateTimeFormat
import java.util.*
import javax.persistence.Column
import javax.persistence.Transient
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size


data class SupervisionUserVo (

    var id: String? = null,

    /*---------------用户基本资料----------------*/
    @ApiModelProperty("用户id")
    var userId: String? = null,

    @ApiModelProperty(value = "登录名")
    @Column(unique = true, nullable = false)
    var username: @Pattern(regexp = NameUtil.regUsername, message = "登录账号不能包含特殊字符且长度不能>16") String? = null,

    @ApiModelProperty(value = "用户名/昵称/姓名")
    var nickname: @NotNull(message = "不能为空") @Size(max = 20, message = "昵称长度不能超过20") String? = null,

    @ApiModelProperty(value = "手机")
    var mobile: @Pattern(regexp = NameUtil.regMobile, message = "11位手机号格式不正确") String? = null,

    @ApiModelProperty(value = "用户头像")
    var avatar: String = CommonConstant.USER_DEFAULT_AVATAR,

    @ApiModelProperty(value = "邮箱")
    var email: @Pattern(regexp = NameUtil.regEmail, message = "邮箱格式不正确") String? = null,

    @ApiModelProperty(value = "性别")
    var sex: String? = null,

    @ApiModelProperty(value = "区域id")
    var areaId: String? = null,

    @ApiModelProperty(value = "所属区域")
    var areaName: String? = null,

    @ApiModelProperty(value = "用户类型 0普通用户 1管理员")
    var type: Int? = null,

    @ApiModelProperty(value = "状态 默认0正常 -1拉黑")
    var status: Int? = null,

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "用户拥有角色")
    var roles: MutableList<Role>? = null,

    /*-----------------监管部门信息----------------*/
    @ApiModelProperty("所属科室")
    var officeName: String? = null,

    @ApiModelProperty("所属科室id")
    var officeId: String? = null,

    @ApiModelProperty("行业id")
    var businessId: String? = null,

    @ApiModelProperty("行业名称")
    var businessName: String? = null,

    @ApiModelProperty("所属职务")
    var dutyName: String? = null,

    @ApiModelProperty("用户级别")
    var userLevel: String? = null,

    @ApiModelProperty("单位代码")
    var dutyCode: String? = null,

    @ApiModelProperty("职务id")
    var dutyId: String? = null,

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间", hidden = true)
    var createTime: Date? = null
)